by the skin of your teeth
​(informal) if you do something by the skin of your teeth, you only just manage to do it
He escaped defeat by the skin of his teeth.